
module klibr
	def split(filename, nlines, prefix, suffix)
		n = 0
		i = 1
		file = nil
		IO.foreach(filename) do |line|
			if n % nlines == 0
				file.close() if not file.nil?
				file = File.new(prefix + i.to_s() + suffix, "w+")
				i += 1
			end
			n += 1
			file.puts(line)
		end
		file.close() if not file.nil?
	end


end
